package com.qing.administer.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qing.administer.entity.SysConfig;
import com.qing.administer.entity.SysLog;
import com.qing.administer.mapper.SysLogMapper;
import com.qing.administer.service.SysLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 系统日志 服务实现类
 * </p>
 *
 * @author qing
 * @since 2021-09-17
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {


	@Autowired
	private SysLogMapper sysLogMapper;

	@Override
	public Page<SysLog> findPage(Long current, Long size, String keyword) {
		Page<SysLog> page=new Page<>(current,size);
		QueryWrapper<SysLog> queryWrapper=new QueryWrapper<>();
		if(StringUtils.hasLength(keyword)){
			queryWrapper.likeRight("method",keyword)
					.or().likeRight("operation",keyword)
					.or().likeRight("username",keyword);
		}
		return sysLogMapper.selectPage(page,queryWrapper);
	}
}
